package com.fbee.smartcommunities.controller;

import com.fbee.smartcommunities.entity.Address;
import com.fbee.smartcommunities.entity.Cart;
import com.fbee.smartcommunities.service.OrderGoodsService;
import com.fbee.smartcommunities.service.OrdersService;
import com.fbee.smartcommunities.vo.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author 汪佳泉
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/orders")
public class OrdersController {

    @Resource
    private OrdersService ordersService;

    @PostMapping("/createOrder")
    public ResultVO<Boolean> createOrder(Long[] id,
                                         Long[] goodId,
                                         Integer[] count,
                                         Long openId,
                                         String linkUser,
                                         String linkAddress,
                                         String linkPhone,
                                         BigDecimal totalPrice,
                                         String payType){
        return ResultVO.success(ordersService.createOrder(id,goodId,count,openId,linkUser,linkAddress,linkPhone,totalPrice,payType),"创建订单成功");
    }

}
